﻿@inject IStringLocalizer<BlockTemplate> Localizer
<div class="mb-3" style="height: 21px;">
    <Block OnQueryCondition="OnQueryCondition2" Name="Template">
        <Authorized>
            <div>@((MarkupString)Localizer["TemplateDiv1"].Value)</div>
        </Authorized>
        <NotAuthorized>
            <div>@((MarkupString)Localizer["TemplateDiv2"].Value)</div>
        </NotAuthorized>
    </Block>
</div>
<Button Icon="@GetIcon2()" Text="@GetText2()" OnClick="ToggleCondition2" />

@code {
    private bool IsShow2 { get; set; } = true;

    private void ToggleCondition2() => IsShow2 = !IsShow2;

    private string GetIcon2() => IsShow2 ? "fa-solid fa-eye-slash" : "fa-solid fa-eye";

    private string GetText2() => IsShow2 ? Localizer["IsHide"] : Localizer["IsShow"];

    private Task<bool> OnQueryCondition2(string name) => Task.FromResult(IsShow2);
}
